#include "taskitem.h"
#include "ui_taskitem.h"

TaskItem::TaskItem(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TaskItem)
{
    ui->setupUi(this);
}

TaskItem::~TaskItem()
{
    delete ui;
}

void TaskItem::paintEvent(QPaintEvent *)
{
    QStyleOption opt;
    opt.init(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}

void TaskItem::setTask(Task *task)
{
    this->task = task;

    ui->taskTitle->setText(task->getAttributeValue(Task::TITLE));
    ui->taskDesc->setText(task->getAttributeValue(Task::DESCRIPTION));
    ui->taskDueDate->setText(task->getAttributeValue(Task::DUEDATE));
    ui->taskTimeCreated->setText(task->getAttributeValue(Task::TIME_CREATED));
    ui->taskDesc->setVisible(false);
}

